/*
 * Copyright (C) 2009 M. Hautle.
 * 
 * This file is part of TrackedBean.
 * 
 * TrackedBean is free software: you can redistribute it and/or modify it under the terms of the GNU Lesser General Public License as published by the Free
 * Software Foundation, either version 3 of the License, or (at your option) any later version.
 * 
 * TrackedBean is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
 * A PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License along with TrackedBean. If not, see <http://www.gnu.org/licenses/>.
 */
package ch.trackedbean.util;

import java.util.*;

/**
 * Hooks for {@link BeanCloner}.<br>
 * You may perform additional tasks for each cloned component using this hook.
 * 
 * @author M. Hautle
 */
public interface IBeanCloneHook {
	/**
	 * Hook called after a bean was cloned.
	 * 
	 * @param src The source bean
	 * @param clone The cloned bean
	 */
	void postBeanClone(Object src, Object clone);

	/**
	 * Hook called after a list was cloned.
	 * 
	 * @param src The source list
	 * @param clone The cloned list
	 */
	void postListClone(List src, List clone);

	/**
	 * Hook called after a set was cloned.
	 * 
	 * @param src The source set
	 * @param clone The cloned set
	 */
	void postSetClone(Set src, Set clone);

	/**
	 * Hook called after a map was cloned.
	 * 
	 * @param src The source map
	 * @param clone The cloned map
	 */
	void postMapClone(Map src, Map clone);

	/**
	 * Hook called after a array was cloned.
	 * 
	 * @param src The source array
	 * @param clone The cloned array
	 */
	void postArrayClone(Object[] src, Object[] clone);

	/**
	 * Hook called before a bean gets cloned.<br>
	 * Use it to replace source objects or to preinitialize proxies.
	 * 
	 * @param src The source bean
	 * @return The object to clone
	 */
	Object preBeanClone(Object src);

	/**
	 * Hook called after a list was cloned.<br>
	 * Use it to replace source lists or to preinitialize proxies.
	 * 
	 * @param src The source list
	 * @return The list to clone
	 */
	List preListClone(List src);

	/**
	 * Hook called after a set was cloned.<br>
	 * Use it to replace source sets or to preinitialize proxies.
	 * 
	 * @param src The source set
	 * @return The set to clone
	 */
	Set preSetClone(Set src);

	/**
	 * Hook called after a map was cloned.<br>
	 * Use it to replace source maps or to preinitialize proxies.
	 * 
	 * @param src The source map
	 * @return The map to clone
	 */
	Map preMapClone(Map src);

	/**
	 * Hook called after a array was cloned.<br>
	 * Use it to replace source arrays or to preinitialize proxies.
	 * 
	 * @param src The source array
	 * @return The array to clone
	 */
	Object[] preArrayClone(Object[] src);

	/**
	 * Returns the type to instanciate for the given object.<br>
	 * You may use this if you try to clone proxies.
	 * 
	 * @param src The source object
	 * @return The type of the object (has to be the same type as src or a super type!)
	 */
	Class<?> getType(Object src);
}
